<template>
  <div>
    <div class="fly-panel">
      <div class="fly-panel-title fly-filter">
        <a>置顶</a>
        <a href="#signin"
           class="layui-hide-sm layui-show-xs-block fly-right"
           id="LAY_goSignin"
           style="color: #FF5722;">去签到</a>
      </div>
      <fly-listitem :lists="lists"
                    @nextpage="nextPage()"
                    :isShow="false"></fly-listitem>
    </div>

  </div>
</template>

<script>
import { getList } from '@/api/content'
import ListItem from './ListItem.vue'
export default {
  name: 'Top',
  components: {
    'fly-listitem': ListItem
  },
  data () {
    return {
      page: 0,
      limit: 20,
      lists: []
    }
  },
  mounted () {
    this._getList()
  },
  methods: {
    // 获取文章列表
    _getList () {
      const options = {
        catalog: this.catalog,
        isTop: 1,
        page: this.page,
        limit: this.limit,
        sort: this.sort,
        tag: this.tag,
        status: this.status
      }
      // 发送请求
      getList(options)
        .then((res) => {
          if (res.code === 200) {
            if (res.data.length < this.limit) {
            }
            if (this.lists.length === 0) {
              this.lists = res.data
            } else {
              this.lists = this.lists.concat(res.data)
            }
          }
        })
        .catch((err) => {
          console.log(err)
        })
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
